import { Config } from './config';
import { ModuleGraph } from './moduleGraph';
import { ChunkGraph } from './chunkGraph';
import { Plugin, PluginDriver } from './plugin';

export class Context {
  config: Config;
  moduleGraph: ModuleGraph;
  chunkGraph: ChunkGraph;
  plugin_driver: PluginDriver;
  // 静态资源的 原始路径 和 输出文件名 的映射关系
  assets: Record<string, string>;

  constructor(config: Config, plugins: Plugin[]) {
    this.config = config;
    this.moduleGraph = new ModuleGraph();
    this.chunkGraph = new ChunkGraph();
    this.plugin_driver = new PluginDriver(plugins);
    this.assets = {};
  }

  emitAsset(orginPath: string, outputName: string) {
    this.assets[orginPath] = outputName;
  }
}
